import {http} from "/utils/request.js"

// 登录方法
export function login(data) {
  return http({
    url: '/login',
    headers: {
      isToken: false,
      repeatSubmit: false
    },
    method: 'post',
    data: data
  })
}

// 注册方法
export function register(data) {
  return http({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return http({
    url: '/getInfo',
    method: 'get'
  })
}

// 退出方法
export function logout() {
  return http({
    url: '/logout',
    method: 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return http({
    url: '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}
export function userxx(uid) {
  return http({
    url: '/system/user/'+uid,
    method: 'get',
    timeout: 20000
  })
}
// 用户密码重置
export function updateUserPwd(oldPassword, newPassword) {
  const baseUrl = 'https://yunke.hxzysx.com:443/system/user/profile/updatePwd';
  const urlWithParams = `${baseUrl}?oldPassword=${oldPassword}&newPassword=${newPassword}`;
	
  return http({
    url: urlWithParams,  // 使用拼接好的 URL
    method: 'put',
    headers: {
      'Content-Type': 'application/json',  // 设置请求头，确保后端能够识别
    }
  });
}
